
export default {
	state: {
		hasLogin: false,
		userInfo: {},
		token:'',
		storeorderlist:[],
	},
	mutations: {
		login(state, provider) {

			state.hasLogin = true;
			state.userInfo = provider;
			console.log("old.js--state.userInfo--",state.userInfo);
			state.token = provider.token //new 
			console.log("old.js--state.token--",state.token);
			uni.setStorage({//缓存用户登陆状态
			    key: 'userInfo',  
			    data: provider //new 
			})  //uni.setStorageSync('userInfo',JSON.stringify(userinfo))
			console.log("old.js----",state.userInfo);
		},
		logout(state) {
			state.hasLogin = false;
			state.userInfo = {};
			uni.removeStorage({  
                key: 'userInfo'  
            })
		},
		setstoreorderlist(state,list){
			state.storeorderlist=list
			
		}
	},
	
	
	// 登录
	// login(state,userinfo){
	// 	state.userInfo = userinfo
	// 	console.log("user.js state.userInfo--",state.userInfo)
	// 	state.loginStatus = true
	// 	state.token = userinfo.token
	// 	state.username=userinfo.username
	// 	// 持久化存储
	// 	uni.setStorageSync('userInfo',JSON.stringify(userinfo))
	// 	console.log("获取uni.getStorageSync--",uni.getStorageSync('userInfo'))
	// },
	// // 退出登录
	// logout(state){
	// 	state.userInfo = {}
	// 	state.loginStatus = false
	// 	state.token = null
	// 	uni.removeStorageSync('userInfo')
	// }
	
	actions: {
	
	}
}